﻿<%@ Page Language="C#" Trace="false" MasterPageFile="~/MasterPage.master" ValidateRequest="false" AutoEventWireup="true" CodeFile="text_edit.aspx.cs" Inherits="LanguageVersioningPage" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
	<script>
		function validateTranslationsForm()
		{
			valDisplayer.hideAllValidationErrors();
			var noErrors = true;

			var nameElem = $("#Name");
			if (!nameElem.val())
			{
				valDisplayer.showValidationError("Required", nameElem);
				noErrors = false;
			}

			return noErrors;
		}	
	</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="body" Runat="Server">

	<form id="form1" runat="server">
		<div>

			<h1>Edit text &quot;<% = editTextDef.Name %>&quot;</h1>
			
			<label for="Name">Name</label><br />
			<input type="text" name="Name" id="Name" value="<% = editTextDef.Name %>" style="width: 500px;" /><br />
			<br />
			<br />
			
			<%
			foreach (SimpleText.Framework.Language lang in CurrentModel.Languages)
			{
				%>
				<div class="clearfix">
					<div style="float: left; margin-top: 2px;" class="<% = GetClassNamesForCssSprite(lang.CultureName) %>"></div><div style="float: left; margin-left: 4px;;"><label><% = lang.Name %></label></div>
				</div>
				<div style="margin-bottom: 15px;">
					<textarea name="text_<% = lang.ShortName %>" style="width: 500px; height: 100px;"><% 
					if (editTextDef.Texts.ContainsKey(lang.ShortName))
					{
						Response.Write(Server.HtmlEncode(editTextDef[lang.ShortName].Content));
					}
					%></textarea>
				</div>
				<%
			}
			%>
			<div class="actionButton">
				<asp:Button onclick="SaveBtnClicked" ID="SaveBtn" runat="server" class="mainSubmit" Text="Save"></asp:Button><br />
				<br />
			</div>
			
		</div>
	</form>

</asp:Content>